import React from "react";
import {Empty, Spin, Typography} from "antd";
import {Link, useParams} from "react-router-dom";
import useRegistration from "@/hooks/useRegistration";
import "./Query.scss"

const Query = () => {
    // 路由传递过来的params参数 医院的编码
    const {hoscode} = useParams()

    const {registration, loading} = useRegistration(hoscode as string)

    const render = () => {
        if (loading) {
            return (
                <Spin spinning={loading}></Spin>
            )
        } else {
            return (
                <Empty description={
                    <Typography.Text>
                        <span>{registration?.hospital.hosname} 查询信息 暂无数据</span> <Link to="/">回首页</Link>
                    </Typography.Text>
                }></Empty>
            )
        }
    }
    return (
        <div className="query">
            {
                render()
            }
        </div>
    )
}

export default Query
